<style scoped lang="less">
</style>
<template>
	<div v-if="pay_result!=null">
		<div v-if="pay_result.pay_status===GLOBAL.PAY_STATUS_PAID_ONLINE">
			<span >支付成功</span>
		</div>
		<div v-else-if="pay_result.pay_status===GLOBAL.PAY_STATUS_PAID_FAILED_ONLINE">
			<span >支付失败</span>
		</div>
		<div v-else-if="pay_result.pay_status===GLOBAL.PAY_STATUS_UN_PAY_ONLINE">
			<span >未接收到支付结果，这通常并不完全代表您支付失败，可能是支付系统返回结果有延迟</span>
			<div ><van-button  @click="getData" type="primary" >刷新试试</van-button></div>
		</div>
		<div ><van-button  plain @click="toVip" type="primary" >返回</van-button></div>
	</div>
</template>
<script>

  import {getPayResult} from "../../api/pay";
  import Vue from 'vue';
  import {Button} from 'vant';
  Vue.use(Button);
  export default {
    name: 'pay-result',
    data() {
      return {
        order_id: null,
        pay_result: null
      };
    },
    created() {
      this.order_id = this.$route.params.order_id;
      this.getData();
    },
    methods: {
      getData() {
        let vm = this;
        getPayResult(this.order_id).then(rep => {
          vm.pay_result = rep.data.data;
        })
      },
      toVip(){
        this.$router.push({name: 'vip'});
      }
    }
  }
</script>